//
//  RealHistoryCell.m
//  CoolTennisBall
//
//  Created by Coollang on 16/8/3.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

#import "RealHistoryCell.h"
#import "RealTimeTrainModel.h"



@interface RealHistoryCell ()

@property (weak, nonatomic) IBOutlet UILabel *trainTimeLabel;

@property (weak, nonatomic) IBOutlet UILabel *trainTypeLabel;

@property (weak, nonatomic) IBOutlet UILabel *trainTimeLongLabel;

@property (weak, nonatomic) IBOutlet UILabel *trainSwingNumLabel;

/** 国际化 */
@property (weak, nonatomic) IBOutlet UILabel *timeTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *totalTrainTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *paiLUnitLabel;
@property (weak, nonatomic) IBOutlet UILabel *minUnitLabel;

@end
@implementation RealHistoryCell


- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    CGFloat fontSize = 0.0f;
    
    if (![NSBundle currentLanguageIsChinese]) {
        self.totalTrainTitleLabel.text = NSLocalizedString(@"Completed", nil);// @"Completed";
        fontSize = 12.0f;
    }else {
        fontSize = 14.0f;
    }

    UIFontDescriptor *attributeFontDescriptor = FontDescriptorMedium(fontSize);
    self.timeTitleLabel.text = NSLocalizedString(@"RealTime Training for", nil);
   
    self.paiLUnitLabel.text =  NSLocalizedString(@"Unit.Shots", nil);
    self.minUnitLabel.text = NSLocalizedString(@"Unit.Minute", nil);
    
    self.trainTypeLabel.font = [UIFont fontWithDescriptor:attributeFontDescriptor size:0.0];
}

- (void)setTrainModel:(RealTimeTrainModel *)trainModel {
    _trainModel = trainModel;
    
    self.trainTimeLabel.text = [trainModel hourAndMinute];
    
    NSString *string = nil;
    trainModel.trainTyep == RealTimeTrainHB ? (string = NSLocalizedString(@"Fore&back Hands", nil)) : (string = NSLocalizedString(@"RealTime.Serve", nil));
    
    self.trainTypeLabel.text = string;
    
    self.trainTimeLongLabel.text = [trainModel trainTimeLong];
    self.trainSwingNumLabel.text = @(trainModel.chartItemArray.count).stringValue;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}

@end
